package com.elangzhi.ssm.exception;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
/**
 * 
* 类名称：MyExceptionResolver.java
* 类描述：异常捕获
* @author Gx
* @version 1.0
 */
public class MyExceptionResolver implements HandlerExceptionResolver{

	public ModelAndView resolveException(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex) {

		ex.printStackTrace();
		ModelAndView mv = new ModelAndView("error","exception",ex);
		//mv.addObject("exception", ex.toString().replaceAll("\n", "<br/>"));
		return mv;
	}

}
